$register_counter = ToNum( GetStoredValue( "REGISTER_COUNTER" ) );
IF ($register_counter == "")
THEN
$register_counter=0;
ENDIF
FOR ($i=0;$i<$register_counter;$i=$i+1)
IF (GetStoredValue( "logon_username_" . $i ) == $userName )
THEN
SetCurrentPlayerVar( "logon_code",GetStoredValue( "logon_code_" . $i ) );
SetCurrentPlayerVar( "logon_password",GetStoredValue( "logon_password_" . $i ) );
ENDIF
ENDFOR
$mList = GetListOfPlayers("N"); //Get list currently connected players
$mCount = arrayCount( $mList ); //Count the number of players in array
$plyNum=0; //Set playernumber to zero
### Walk through array of connected players and get their username ###
WHILE ($plyNum < $mCount)
$uName = $mList[$plyNum];
$plyNum=$plyNum+1;
ENDWHILE
### End ###
$userName = GetCurrentPlayerVar( "UserName" );
SetStoredValue( $userName . "recomended", GetCurrentPlayerVar( "recomended" ) );
This can go in the OnConnect or OnConnectClose event:
### Get UserName and search in storedvalue.dbs for saved values for this user ###
$userName = GetCurrentPlayerVar( "UserName" );
SetCurrentPlayerVar( "total",GetStoredValue( $userName . "total" ) );
### End ###
If the value would be empty (because someone is new on your server, you can check if it is and give it a default value:
### Set default values if no values are loaded ###
IF ( GetCurrentPlayerVar( "config_pb_display_gui" ) == "")
THEN
SetCurrentPlayerVar( "total",0 ); # Set default value to 0
ENDIF
### End ###
This should go in a seperate event to save the value or values back to the database:
$userName = GetCurrentPlayerVar( "UserName" );
SetStoredValue( $userName . "total", GetCurrentPlayerVar( "total" ) );
### Declare global variables ###
GlobalVar $testvar;
### End ###
### Give global variables an empty value ###
$testvar=0;
### End ###
GlobalMsg ("Debug: ".$testvar);
$testvar=0; //just for this example to give it any value
$testvar=$testvar+1;